/*
 * Project: a2
 * Copyright (C) 2008 ralfoide gmail com,
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.alfray.a2;

import android.app.Activity;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class PrefsValues {

    public static final String KEY_VIB_SEQ = "vib_seq";
	public static final String KEY_VIB_TOUCH = "vib_touch";
    public static final String KEY_PLAY_ANIMS = "play_anims";
    public static final String KEY_VISUAL = "visual";

    public static final String DEFAULT_VISUAL = "truckin";

    private boolean mPlayAnims;
	private boolean mVibrateTouch;
	private boolean mVibrateSequence;
    private String mVisualTheme;

	public PrefsValues() {
		reset();
	}

	public boolean playAnims() {
		return mPlayAnims;
	}

	public boolean vibrateTouch() {
		return mVibrateTouch;
	}

	public boolean vibrateSequence() {
		return mVibrateSequence;
	}

	public String getVisualTheme() {
        return mVisualTheme;
    }

	public void reset() {
		mPlayAnims = true;
		mVibrateTouch = true;
		mVibrateSequence = true;
		mVisualTheme = DEFAULT_VISUAL;
	}

	public void update(Activity activity) {
		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);

		mPlayAnims = prefs.getBoolean(KEY_PLAY_ANIMS, true);
		mVibrateTouch = prefs.getBoolean(KEY_VIB_TOUCH, true);
		mVibrateSequence = prefs.getBoolean(KEY_VIB_SEQ, true);
		mVisualTheme = prefs.getString(KEY_VISUAL, DEFAULT_VISUAL);
	}
}
